package com.ruoyi.teaching.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingResMapper;
import com.ruoyi.teaching.domain.TeachingRes;
import com.ruoyi.teaching.service.ITeachingResService;

/**
 * 资源信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-21
 */
@Service
public class TeachingResServiceImpl implements ITeachingResService 
{
    @Autowired
    private TeachingResMapper teachingResMapper;

    /**
     * 查询资源信息
     * 
     * @param resourcesId 资源信息主键
     * @return 资源信息
     */
    @Override
    public TeachingRes selectTeachingResByResourcesId(Long resourcesId)
    {
        return teachingResMapper.selectTeachingResByResourcesId(resourcesId);
    }

    /**
     * 查询资源信息列表
     * 
     * @param teachingRes 资源信息
     * @return 资源信息
     */
    @Override
    public List<TeachingRes> selectTeachingResList(TeachingRes teachingRes)
    {
        return teachingResMapper.selectTeachingResList(teachingRes);
    }

    /**
     * 新增资源信息
     * 
     * @param teachingRes 资源信息
     * @return 结果
     */
    @Override
    public int insertTeachingRes(TeachingRes teachingRes)
    {
        teachingRes.setCreateTime(DateUtils.getNowDate());
        return teachingResMapper.insertTeachingRes(teachingRes);
    }

    /**
     * 修改资源信息
     * 
     * @param teachingRes 资源信息
     * @return 结果
     */
    @Override
    public int updateTeachingRes(TeachingRes teachingRes)
    {
        teachingRes.setUpdateTime(DateUtils.getNowDate());
        return teachingResMapper.updateTeachingRes(teachingRes);
    }

    /**
     * 批量删除资源信息
     * 
     * @param resourcesIds 需要删除的资源信息主键
     * @return 结果
     */
    @Override
    public int deleteTeachingResByResourcesIds(Long[] resourcesIds)
    {
        return teachingResMapper.deleteTeachingResByResourcesIds(resourcesIds);
    }

    /**
     * 删除资源信息信息
     * 
     * @param resourcesId 资源信息主键
     * @return 结果
     */
    @Override
    public int deleteTeachingResByResourcesId(Long resourcesId)
    {
        return teachingResMapper.deleteTeachingResByResourcesId(resourcesId);
    }
}
